package net.devkit.core.mail;

import org.apache.commons.lang.StringUtils;

/**
 * 邮件模板的定义,一封邮件可以有多个模板
 * 
 * @author Atomic
 */
public class MailTemplateDefinition {

	String to; // 收件人
	String from; // 发件人地址
	String subject; // 邮件标题
	String plainTextTemplate; // 纯文本格式的邮件模板
	String htmlTemplate; // html格式的邮件模板

	/**
	 * 该封邮件是否拥有html头
	 */
	public boolean isHtmlMail() {
		return StringUtils.isNotBlank(htmlTemplate);
	}

	/**
	 * 该封邮件是否拥有富文本头
	 */
	public boolean isPlainTextMail() {
		return StringUtils.isNotBlank(plainTextTemplate);
	}

	/**
	 * 是否是两种格式都有的
	 */
	public boolean isAlternativeMail() {
		return isPlainTextMail() && isHtmlMail();
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getPlainTextTemplate() {
		return plainTextTemplate;
	}

	public void setPlainTextTemplate(String plainTextTemplate) {
		this.plainTextTemplate = plainTextTemplate;
	}

	public String getHtmlTemplate() {
		return htmlTemplate;
	}

	public void setHtmlTemplate(String htmlTemplate) {
		this.htmlTemplate = htmlTemplate;
	}

}
